home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / MEMORY / OLD / MEM208SRC / FSLib / c / _GBPB < prev    next >
Text File  |  1993-08-22  |  1KB  |  45 lines

  1. /* Original code (c) Acorn Computers Ltd, 1992-3 */
  2.  
  3. /* $Id: c._GBPB 3.1 93/03/09 23:19:57 brian Exp $ */
  4.  
  5. #include "FS.h"
  6.  
  7. _kernel_oserror *fsentry_gbpb( FSEntry_GBPB_Parameter *parm )
  8. {
  9.         _kernel_oserror *err=NULL;
  10.         int pos,len;
  11.         FileEntry *fe=(FileEntry *)parm->handle;
  12.         FileDesc d = FileEntry_Desc( fe );
  13.         if ( d.buffered )
  14.           return ERR(mb_BadParameters);
  15.         pos = -1;
  16. #ifdef DEBUG
  17.   printf("GBPB(%d)%x,%x,%x,%x\n",*parm);
  18. #endif
  19.  
  20.         switch ( parm->reason )
  21.         {
  22.         case FSEntry_GBPB_Reason_PutMultipleBytesHere:
  23.           pos = parm->sequential_file_pointer;
  24.           /* FALLTHROUGH */
  25.         case FSEntry_GBPB_Reason_PutMultipleBytes:
  26.           err=FileEntry_PutBytes( fe, parm->address, pos, len = parm->number,&pos );
  27.           break;
  28.         case FSEntry_GBPB_Reason_GetMultipleBytesHere:
  29.           pos = parm->sequential_file_pointer;
  30.           if (pos>d.length)
  31.           { len = 0; err = NULL; pos = FileEntry_SeqPtr(fe); break; }
  32.           /* FALLTHROUGH */
  33.         case FSEntry_GBPB_Reason_GetMultipleBytes:
  34.           err=FileEntry_GetBytes( fe, parm->address, pos, parm->number,&pos,&len );
  35.           break;
  36.         default:
  37.           return ERR(mb_BadParameters);
  38.         }
  39.         if (err) return err;
  40.         parm->address+=len;
  41.         parm->number-=len;
  42.         parm->sequential_file_pointer=pos;
  43.         return NULL;
  44. }
  45.